/**
 * 
 */
package vn.edu.ctu.cit.se.android.karfinder;

import android.content.Context;
import android.view.View;
import android.widget.TextView;

/**
 * @author Val
 *
 */
public class Song {
	private int id;
	private String title;
	private String lyrics;
	private String composer;
	private String genre;
	private int favorite;
	
	public Song() {
		this.id = 0;
		this.title = "";
		this.lyrics = "";
		this.composer = "";
		this.genre = "";
		this.favorite = 0;
	}
	
	public Song(int id, String title, String lyrics,
				String composer, String genre, int favorite) {
		this.id = id;
		this.title = title;
		this.lyrics = lyrics;
		this.composer = composer;
		this.favorite = favorite;
		
		String genreCodes = "tcnp";
		String[] genreNames = { "Tân nhạc", "Cổ nhạc", "Thiếu nhi", "Pop" };
		
		for (int i = 0; i < genreCodes.length(); ++i)
			if (genre.charAt(0) == genreCodes.charAt(i)) {
				this.genre = genreNames[i];
				break;
			}
		
	}
	
	/**
	 * @return the id
	 */
	public int getId() {
		return id;
	}
	
	/**
	 * @param id the id to set
	 */
	public void setId(int id) {
		this.id = id;
	}
	
	/**
	 * @return the title
	 */
	public String getTitle() {
		return title;
	}
	
	/**
	 * @param title the title to set
	 */
	public void setTitle(String title) {
		this.title = title;
	}
	
	/**
	 * @return the lyrics
	 */
	public String getLyrics() {
		return lyrics;
	}
	
	/**
	 * @param lyrics the lyrics to set
	 */
	public void setLyrics(String lyrics) {
		this.lyrics = lyrics;
	}
	
	/**
	 * @return the composer
	 */
	public String getComposer() {
		return composer;
	}
	
	/**
	 * @param composer the composer to set
	 */
	public void setComposer(String composer) {
		this.composer = composer;
	}

	/**
	 * @return the genre
	 */
	public String getGenre() {
		return genre;
	}

	/**
	 * @param genre the genre to set
	 */
	public void setGenre(String genre) {
		this.genre = genre;
	}

	/**
	 * @return the favorite
	 */
	public boolean getFavorite() {
		return (favorite != 0 ? true : false);
	}

	/**
	 * @param favorite the favorite to set
	 */
	public void setFavorite(int favorite) {
		this.favorite = favorite;
	}
	
	public String toString() {
		return (this.id + " | " + this.title + " | " + this.lyrics + " | " +
				this.composer + " | " + this.genre + " | " + this.favorite);
	}
}
